package com.jun2yah.quiz;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Result extends Activity {

	int score = 0;
	int numOfWords = 0;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	
	    setContentView(R.layout.result);
	    
	    // 몇번 문제인지 & 점수 count
		Intent intent = getIntent();
		numOfWords = intent.getIntExtra("NumOfWords", 0);
		score = intent.getIntExtra("Score", 0);
		
	    TextView textScore = (TextView)findViewById(R.id.textScore);
	    textScore.setText(score/numOfWords * 100 + "점");
	    
	    TextView textResult = (TextView)findViewById(R.id.textResult);
	    textResult.setText("총 " + numOfWords + "문제 중 " + score + "문제 맞추셨습니다.");
	    
	    Button btnRetry = (Button)findViewById(R.id.btnRetry);
	    btnRetry.setOnClickListener(new Button.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(Result.this, Quiz.class);
				intent.putExtra("Step", 0);
				startActivity(intent);
			}
	    });
	}
	
	/**
	 * 뒤로가기 버튼 이벤트 
	 * 어떤 이벤트도 일어나지 않도록한다.
	 * 
	 * @see android.app.Activity#onBackPressed()
	 * @Method onBackPressed
	 *
	 * @author jun2yah
	 * @date 2011. 6. 10. 오후 10:53:55
	 */
	@Override
    public void onBackPressed() {}
}
